import axios from '@/libs/api.request'
import config from '@/config'

export const getFlowTable = async (playload) => {
  const resp = await axios.request({
    url: config.apiUrl,
    params: {
      module: 'FinancialService.accountView',
      ...playload
    },
    method: 'get'
  })
  return resp
}

export const getAccountBalance = async (playload) => {
  const resp = await axios.request({
    url: config.apiUrl,
    params: {
      module: 'FinancialService.accountValue',
      ...playload
    },
    method: 'get'
  })
  return resp
}

export const getSaleCount = async (playload) => {
  const resp = await axios.request({
    url: config.apiUrl,
    params: {
      module: 'FinancialService.saleCount',
      ...playload
    },
    method: 'get'
  })
  return resp
}

export const getAccountFundingMessage = async (playload) => {
  const resp = await axios.request({
    url: config.apiUrl,
    params: {
      module: 'AdminService.chargeRequestView',
      ...playload
    },
    method: 'get'
  })
  return resp
}

export const getFundingTable = async (playload) => {
  const resp = await axios.request({
    url: config.apiUrl,
    params: {
      module: 'AdminService.accountView',
      ...playload
    },
    method: 'get'
  })
  return resp
}

export const editFundingRecord = async (playload) => {
  const data = {
    module: 'AdminService.moneyUpdate',
    ...playload
  }
  const resp = await axios.request({
    url: config.postUrl,
    data,
    method: 'post'
  })
  return resp
}

export const chargeRequest = async (playload) => {
  const data = {
    module: 'FinancialService.chargeRequest',
    ...playload
  }
  const resp = await axios.request({
    url: config.postUrl,
    data,
    method: 'post'
  })
  return resp
}

export const getFundingRecordTable = async (playload) => {
  const resp = await axios.request({
    url: config.apiUrl,
    params: {
      module: 'AdminService.chargeView',
      ...playload
    },
    method: 'get'
  })
  return resp
}

// export const editCustomerRecord = async (playload) => {
//   let module_name = 'ContentService.add'
//   if (playload.id && playload.id !== '') {
//     module_name = 'ContentService.update'
//   }
//   const data = {
//     module: module_name,
//     ...playload
//   }
//   const resp = await axios.request({
//     url: config.postUrl,
//     data,
//     method: 'post'
//   })
//   return resp
// }
